/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utils;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import models.Student;
import models.Students;

/**
 *
 * @author plato
 */
public class LoadXml {

    Students students;

    public LoadXml(String path) throws IOException {
        try {
            File file = new File(path);
            JAXBContext jaxbContext = JAXBContext.newInstance(Students.class);

            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            students = (Students) jaxbUnmarshaller.unmarshal(file);
        } catch (JAXBException ex) {
            Logger.getLogger(LoadXml.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public Students getStudents() {
        return students;
    }

    public void setStudents(Students students) {
        this.students = students;
    }
    
}
